home *** CD-ROM | disk | FTP | other *** search
/ Mac-Source 1994 July / Mac-Source_July_1994.iso / Other Langs / Tickle-4.0 (tcl) / library / help / tcl / strings / string < prev    next >
Encoding:
Text File  |  1993-10-26  |  4.8 KB  |  102 lines  |  [TEXT/$Tcl]

  1.  
  2.           string option arg ?arg ...?
  3.  
  4.  
  5.      DESCRIPTION
  6.           Performs one of  several  string  operations,  depending  on
  7.           option.  The legal options (which may be abbreviated) are:
  8.  
  9.           string compare string1 string2
  10.                Perform a character-by-character comparison of  strings
  11.                string1  and  string2  in  the same way as the C strcmp
  12.                procedure.  Return -1, 0, or 1,  depending  on  whether
  13.                string1  is  lexicographically  less than, equal to, or
  14.                greater than string2.
  15.  
  16.           string first string1 string2
  17.                Search  string2  for  a  sequence  of  characters  that
  18.                exactly  match  the  characters  in string1.  If found,
  19.                return the index of the first character  in  the  first
  20.                such match within string2.  If not found, return -1.
  21.  
  22.           string index string charIndex
  23.                Returns the charIndex'th character of the string  argu-
  24.                ment.   A charIndex of 0 corresponds to the first char-
  25.                acter of the string.  If charIndex is less  than  0  or
  26.                greater  than or equal to the length of the string then
  27.                an empty string is returned.
  28.  
  29.           string last string1 string2
  30.                Search  string2  for  a  sequence  of  characters  that
  31.                exactly  match  the  characters  in string1.  If found,
  32.                return the index of the first  character  in  the  last
  33.                such  match within string2.  If there is no match, then
  34.                return -1.
  35.  
  36.           string length string
  37.                Returns a decimal string giving the number  of  charac-
  38.                ters in string.
  39.  
  40.           string match pattern string
  41.                See if pattern matches string; return 1 if it  does,  0
  42.                if  it  doesn't.  Matching is done in a fashion similar
  43.                to that used by the C-shell.  For the  two  strings  to
  44.                match, their contents must be identical except that the
  45.                following special sequences may appear in pattern:
  46.  
  47.                *         Matches any sequence of characters in string,
  48.                          including a null string.
  49.  
  50.                ?         Matches any single character in string.
  51.  
  52.                [chars]   Matches any character in  the  set  given  by
  53.                          chars.  If a sequence of the form x-y appears
  54.                          in chars, then any character between x and y,
  55.                          inclusive, will match.
  56.  
  57.                \x        Matches the single character  x.   This  pro-
  58.                          vides a way of avoiding the special interpre-
  59.                          tation of the characters *?[]\ in pattern.
  60.  
  61.           string range string first last
  62.                Returns a range of consecutive characters from  string,
  63.                starting  with  the  character whose index is first and
  64.                ending with the character  whose  index  is  last.   An
  65.                index of 0 refers to the first character of the string.
  66.                Last may be end (or any abbreviation of it) to refer to
  67.                the  last  character  of  the string.  If first is less
  68.                than zero then it is treated as if it were zero, and if
  69.                last  is  greater  than  or  equal to the length of the
  70.                string then it is treated as if it were end.  If  first
  71.                is greater than last then an empty string is returned.
  72.  
  73.           string tolower string
  74.                Returns a value equal to string except that  all  upper
  75.                case letters have been converted to lower case.
  76.  
  77.           string toupper string
  78.                Returns a value equal to string except that  all  lower
  79.                case letters have been converted to upper case.
  80.  
  81.           string trim string ?chars?
  82.                Returns a value equal to string except that any leading
  83.                or  trailing characters from the set given by chars are
  84.                removed.  If chars is not specified then white space is
  85.                removed (spaces, tabs, newlines, and carriage returns).
  86.  
  87.           string trimleft string ?chars?
  88.                Returns a value equal to string except that any leading
  89.                characters from the set given by chars are removed.  If
  90.                chars is not specified  then  white  space  is  removed
  91.                (spaces, tabs, newlines, and carriage returns).
  92.  
  93.           string trimright string ?chars?
  94.                Returns a value equal to string except that any  trail-
  95.                ing characters from the set given by chars are removed.
  96.                If chars is not specified then white space  is  removed
  97.                (spaces, tabs, newlines, and carriage returns).
  98.  
  99.  
  100.      KEYWORDS
  101.           case conversion, compare, index, match, pattern, string
  102.